import { View, Image } from "@tarojs/components";
import { useEffect, useState } from "react";
import { connect } from "react-redux";
import { AtActionSheet, AtActionSheetItem } from "taro-ui";
import { AtBadge } from "taro-ui";
import Taro from "@tarojs/taro";
import "./index.scss";

import cartImg from "../../image/购物车.png";

const temp = props => {
  const [isOpened, SetIsOpened] = useState<boolean>(false);

  return (
    <View>
      <View
        className="flex_wrapper"
        onClick={() => {
          Taro.switchTab({
            url: "/pages/cart/index"
          });
        }}
      >
        <AtBadge value={props.cart.length}>
          <Image style={{}} src={cartImg}></Image>
        </AtBadge>
      </View>
    </View>
  );
};
export default connect(({ cart }) => ({ cart }))(temp);
